package main

import (
	"fmt"
	"net"
	"net/url"
	"strconv"
)

func main() {
	endpoints := []string{
		"http://127.0.0.1:8000?isSecure=false",
		"grpc://127.0.0.1:9000?isSecure=false",
	}
	for _, endponint := range endpoints {
		parse, err := url.Parse(endponint)
		if err != nil {
			panic(parse)
		}
		fmt.Println(parse)
		fmt.Println(parse.Hostname())
		fmt.Println(parse.Port())
		parseUint, err := strconv.ParseUint(parse.Port(), 10, 16)
		if err != nil {
			return
		}
		fmt.Println(net.JoinHostPort(parse.Hostname(), strconv.FormatUint(parseUint, 10)))
		fmt.Println("-------------------------------")
	}
}
